package homework3;

import java.util.Scanner;

public class Chapter01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int h=0;
        int w=0;
        while (h<3||w<3) {
            System.out.println("请输入矩形的高度：");
            h = sc.nextInt();
            System.out.println("请输入矩形的宽度：");
            w = sc.nextInt();
        }

            for(int i=1;i<=h;i++) {
                for (int j = 1; j <= w; j++){
                    if (i==1 || j==1 || j==w || i==h){
                        System.out.print("*");
                    }else{
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
    }
}
